<template>
  <div class="login-wrap">
    <div class="login-content">
      <div class="login-content-left"></div>
      <div class="login-content-right">
        <div class="right-content">
          <LoginForm />
          <ForgetPasswordForm />
          <RegisterForm />
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  import { computed, ref } from 'vue';
  import LoginForm from './LoginForm.vue';
  import ForgetPasswordForm from './ForgetPasswordForm.vue';
  import RegisterForm from './RegisterForm.vue';
  import { useGlobSetting } from '/@/hooks/setting';
  import { useDesign } from '/@/hooks/web/useDesign';

  defineProps({
    sessionTimeout: {
      type: Boolean,
    },
  });

  const globSetting = useGlobSetting();
  const { prefixCls } = useDesign('login');
  const title = computed(() => globSetting?.title ?? '');
</script>
<style lang="less">
  @prefix-cls: ~'@{namespace}-login';
  @logo-prefix-cls: ~'@{namespace}-app-logo';
  @countdown-prefix-cls: ~'@{namespace}-countdown-input';
  @dark-bg: #293146;

  html[data-theme='dark'] {
    .@{prefix-cls} {
      background-color: @dark-bg;

      &::before {
        background-image: url(/@/assets/svg/login-bg-dark.svg);
      }

      .ant-input,
      .ant-input-password {
        background-color: #232a3b;
      }

      .ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
        border: 1px solid #4a5569;
      }

      &-form {
        background: transparent !important;
      }

      .app-iconify {
        color: #fff;
      }
    }

    input.fix-auto-fill,
    .fix-auto-fill input {
      -webkit-text-fill-color: #c9d1d9 !important;
    }
  }

  .@{prefix-cls} {
    min-height: 100%;
    overflow: hidden;
    @media (max-width: @screen-xl) {
      background-color: #293146;

      .@{prefix-cls}-form {
        background-color: #fff;
      }
    }

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      margin-left: -48%;
      background-image: url(/@/assets/svg/login-bg.svg);
      background-position: 100%;
      background-repeat: no-repeat;
      background-size: auto 100%;
      content: '';
      @media (max-width: @screen-xl) {
        display: none;
      }
    }

    .@{logo-prefix-cls} {
      position: absolute;
      top: 12px;
      height: 30px;

      &__title {
        font-size: 16px;
        color: #fff;
      }

      img {
        width: 32px;
      }
    }

    .container {
      .@{logo-prefix-cls} {
        display: flex;
        width: 60%;
        height: 80px;

        &__title {
          font-size: 24px;
          color: #fff;
        }

        img {
          width: 48px;
        }
      }
    }

    &-sign-in-way {
      .anticon {
        font-size: 22px;
        color: #888;
        cursor: pointer;

        &:hover {
          color: var(--el-color-primary);
        }
      }
    }

    .el-from,
    .login {
      min-width: 360px;

      @media (max-width: @screen-xl) {
        min-width: 320px;
      }

      @media (max-width: @screen-lg) {
        min-width: 260px;
      }

      @media (max-width: @screen-md) {
        min-width: 240px;
      }

      @media (max-width: @screen-sm) {
        min-width: 160px;
      }
    }

    .@{countdown-prefix-cls} input {
      min-width: unset;
    }

    .ant-divider-inner-text {
      font-size: 12px;
      color: @text-color-secondary;
    }
  }
</style>
<style lang="less" scoped>
  @bg_color: #fff;
  @font_color: #666;
  /* ui rest */
  :deep(.el-form-item__content) {
    position: relative;
  }

  :deep(.el-input-group--prepend > .el-input__inner:hover) {
    box-shadow: none;
  }

  :deep(.el-input-group--prepend > .el-input__inner:focus) {
    box-shadow: none;
  }

  :deep(.el-form-item.is-error .el-input__inner) {
    box-shadow: none;
  }

  :deep(.el-input input) {
    background: transparent;
    border: 0px;
    -webkit-appearance: none;
    border-radius: 0px;
    box-shadow: none;
    font-size: 12px;
  }

  .login-wrap {
    height: 100%;
    position: relative;
    background: @bg_color;
  }

  .login-content {
    display: flex;
    width: 100%;
    height: 100%;
    justify-items: stretch;
    .login-content-left {
      width: 50%;
      background: url(/@/assets/images/login_bg.png) center no-repeat;
      background-size: cover;
    }
    .login-content-right {
      width: 50%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      .right-content {
        width: 400px;
        padding: 40px;
        .other-actions {
          text-align: right;
        }
      }
    }
  }

  .login-tips {
    font-size: 12px;
    line-height: 20px;
    color: #ddd;
  }

  :deep(.el-divider__text) {
    background: @bg_color;
    color: @font_color;
  }

  :deep(.el-radio__label) {
    color: @font_color;
  }

  :deep(.el-checkbox__label) {
    color: @font_color;
  }
</style>
